#-*- coding:utf-8 -*-
"""
author:tuhou
time:2021/4/5 下午5:44 
思路：
"""
import requests
import execjs
import time
from urllib import parse


# 导入js
with open('jidianjing-极电竞-加速乐.js', 'r',encoding="utf-8") as f:
    decryptjs = f.read()
ctx = execjs.compile(decryptjs)

timestamp = int(time.time()*1000)
sign = ctx.call('getsign',timestamp)
# print(sign)
# 字符串转url编码
sign = parse.quote(sign)

url = 'https://www.jdj007.com/api/match/list'


params = {
    'gameType':'1',
    'beginTime':'1617811200000',
    'endTime':  '1617897599999',
    'sortTypes[]':'21',
    'sortTypes[]':'24',
    'sortTypes[]':'1',
    'customSort':'true',
    'ongoingBeginTime':'1617811200000',
    'lang':'cn',
    'timestamp':timestamp,
    'sign':sign
}

headers = {
            "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
            "referer": "https://www.jdj007.com/",
            "sec-ch-ua": '"Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"',

        }

res = requests.get(url = url,params = params,headers = headers).json()
print(res)

